This invention relates generally to parsing, and more particularly to dynamic (that is, real-time) parsing.
Computer programs have become increasingly more complex. As a result, whereas before a single programmer may have been responsible for developing a computer program, today frequently teams of programmers are responsible for developing a given program. The source code for such programs may exceed hundreds of pages in length. Thus, the programmers job is one that has become more increasingly more difficult.
As a result, a market for compilersxe2x80x94which are computer programs that turn source code of a program into an executable version that can actually be run on a computerxe2x80x94that make programming easier has proliferated. The compilers indicate the errors to the programmer when the files are saved and the build (compiling/linking) process is initiated. This makes the programmer""s job very hard, in that he or she has to wait until compiling a program to learn that errors have been introduced into the source code. Once these errors are corrected compilers generate browse information which can be queried in software development environments. This browse information is an aid to further program development, but, is correct only up to the last compile. As new code is added this information is out of date and is not very useful in writing new code.
A downside of this explicit compiling is that it may be inconvenient for the programmer to have to initiate the build process him or herself. The compilation process in large complex programs takes a sufficiently large time that a programmer will not initiate it very often. Where the programmer specifies that the build process take place each time the source code is saved, this sort of compilation may nevertheless be inconvenientxe2x80x94the programmer may, for instance, have written significant source code prior to performing a save operation, such that when the errors are pointed out by this process, the programmer may not easily recall what source code the errors relate to, etc. Also the software development environment cannot provide much assistance with respect to new code being written since the last compile. For these and other reasons, there is a need for the present invention.
The above-identified problems, shortcomings and disadvantages with the prior art, as well as other problems, shortcoming and disadvantages, are solved by the present invention, which will be understood by reading and studying the specification and the drawings. In one embodiment, a system includes an editor and a dynamic parser. The editor provides for developing of source code for a computer program. The dynamic parser parses the source code as the source code is developed within the editor during predetermined times (for example, in one embodiment, every second or at the end of every statement or when the software development environment is inactive or idle e.g. when a programmer pauses to think). In one embodiment, the dynamic parser generates a file (or, database) known as a no-compile-browse (NCB) file (or, database), and a database engine to provide for querying of the NCB file (or, database). The dynamic parser can query the above database at any time and provide information in various ways to the benefit of the user and to aid in development of the program. The dynamic parser needs to be extremely tolerant of syntax and semantic errors in the user code because it can be operating with essentially incomplete/invalid code because it is not known in advance at what stage dynamic parsing will be activated. Thus, embodiments of the invention provide for advantages not found in the prior art. While a programmer is developing or writing source code for a program, in one embodiment the dynamic parser can parse the source code in the background, as the programmer is writing the code. The dynamic parser can thus in one embodiment find errors in the program, such that the editor can highlight these errors to the programmer (for example, by underlining the offending source code relating to the error).The dynamic parser can in another embodiment use the information in the NCB file/database to provide real time updated information about the program and provide other means to help the programmer as described later. In this manner, development of computer programs is made easier as compared to the prior art. Thus, parsing is accomplished in a real-time, not static, manner.
In one embodiment of the invention, the dynamic parsing is performed with respect to program development in the language C++. As those of ordinary skill within the art can appreciate, dynamic parsing in this context is much more difficult to perform than in languages such as BASIC and Pascal. Therefore, another advantage of the invention is that it is applicable to languages such as C++.
Other advantages of dynamic parsing include: the identification of errors and warnings in the code as the user types; the providing of a schematic description of the application or the program as the user types; and, the providing of auto-completion information, as described in more detail in the applications incorporated by reference. Besides the embodiments, advantages and aspects of the invention described here, the invention also includes other embodiments, advantages and aspects, as will become apparent by reading and studying the drawings and the following description.
By xe2x80x98schematic descriptionxe2x80x99 we mean a graphical view of the NCB file/database. The graphical view shows various entities in a program, their properties and relationships to each other. This graphical view provides an outline of the program and allows the programmer to navigate from any part of the view to the actual source code that corresponds to that entity.